package com.ruitu.mall_98_1.product.adapter;

import android.content.Context;
import android.widget.TextView;

import com.beanu.arad.base.my_base.base_list.ListBaseAdapter;
import com.beanu.arad.base.my_base.base_list.SuperViewHolder;
import com.beanu.arad.utils.CalcUtils;
import com.ruitu.mall_98_1.R;
import com.ruitu.router_module.bean.product.Section;

public class SectionListAdapter extends ListBaseAdapter<Section> {
    public SectionListAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.pro_item_section;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tv_info = holder.getView(R.id.tv_info);

        Section sec = mDataList.get(position);
        Double d1 = sec.getDiscountProportion();
        if (null != d1) {
            String discount = CalcUtils.sub(100D, d1) + "";
            tv_info.setText("区间价：购买数量在" + sec.getBeginNum() + "--" + sec.getEndNum() + "之间折扣" + discount + "%");
        } else {
            tv_info.setText("区间价：购买数量在" + sec.getBeginNum() + "--" + sec.getEndNum() + "之间折扣" + 100 + "%");
        }
    }
}
